# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from typing import Union
from fastapi import Query
from pydantic import BaseModel, Field


class SquareVideoSearchIn(BaseModel):
    """ 视频广场搜索参数 """
    page_no: int = Query(gt=0, default=1, description="当前页码")
    page_size: int = Query(gt=0, le=200, default=15, description="每页条数")
    name: Union[str, None] = Query(default=None, description="视频名称")
    user: Union[str, None] = Query(default=None, description="用户编号")
    cate_id: Union[int, str, None] = Query(default="", description="所属分类")
    is_enable: Union[int, str, None] = Query(default="", description="是否显示: [0=否, 1=是]")
    audit_status: Union[int, str, None] = Query(default="", description="审核状态: [0=待审, 1=通过, 2=拒绝]")
    start_time: Union[int, str, None] = Query(default=None, description="开始时间")
    end_time: Union[int, str, None] = Query(default=None, description="结束时间")


class SquareVideoAuditIn(BaseModel):
    """ 视频广场审核参数 """
    id: int = Field(..., gt=0, description="广场ID")
    audit_result: str = Field(default="", max_length=400, description="拒绝原因")
    audit_status: int = Field(ge=1, le=2, description="是否显示: [1=通过, 2=拒绝]")


class SquareVideoEditIn(BaseModel):
    """ 视频广场编辑参数 """
    id: int = Field(..., gt=0, description="广场ID")
    cate_id: int = Field(..., ge=0, description="分类ID")
    sort: int = Field(default=0, ge=0, le=999999, description="排序编号")
    is_enable: int = Field(default=0, ge=0, le=1, description="是否显示: [0=否, 1=是]")


class SquareVideoIdIn(BaseModel):
    """ 视频广场ID参数 """
    id: int = Field(..., gt=0, description="广场ID")
    reason: str = Field(default="", description="原因描述")


"""--------------- Separator ---------------"""


class SquareVideoListVo(BaseModel):
    """ 视频广场列表Vo """
    id: int = Field(description="ID")
    cate_id: int = Field(description="分类ID")
    category: str = Field(description="所属分类")
    video_code: str = Field(description="视频编号")
    video_url: str = Field(description="视频地址")
    prompt: str = Field(description="输入提示词")
    sort: int = Field(description="分类排序")
    source: int = Field(description="来源: [1=后台, 2=用户]")
    public_sum: int = Field(description="公开次数")
    audit_result: str = Field(description="审核结果")
    audit_status: int = Field(description="审核状态: [0=待审, 1=通过, 2=拒绝]")
    is_enable: int = Field(description="是否显示: [0=否, 1=是]")
    create_time: str = Field(description="创建时间")
    update_time: str = Field(description="更新时间")
    user: dict = Field(description="用户信息")

    class Config:
        json_schema_extra = {
            "example": {
                "id": 1,
                "cate_id": 0,
                "category": "-",
                "video_code": "d13d6e0eae3f54efec6b3cdee5a47795",
                "video_url": "https://xx.cn/storage/applies/video/8cfe8736.mp4",
                "prompt": "一只在奔跑的小狗",
                "sort": 0,
                "audit_result": "",
                "audit_status": 0,
                "is_enable": 1,
                "create_time": "2025-04-10 15:57:31",
                "update_time": "2025-04-10 15:57:31",
                "user": {
                    "sn": "52778960",
                    "nickname": "罗非鱼",
                    "mobile": "13800138000",
                    "avatar": "https://xx.cn/static/images/default_avatar.png"
                }
            }
        }
